<?php
/*
 * @ https://EasyToYou.eu - IonCube v11 Decoder Online
 * @ PHP 7.2 & 7.3
 * @ Decoder version: 1.1.6
 * @ Release: 10/08/2022
 */

// Decoded file for php version 71.
namespace AlibabaCloud\Client\Credentials\Providers;

class Provider
{
    protected $expirationSlot = 180;
    protected $client;
    protected $error = "Result contains no credentials";
    protected static $credentialsCache = [];
    const DURATION_SECONDS = 3600;
    public function __construct(\AlibabaCloud\Client\Clients\Client $client)
    {
        $this->client = $client;
    }
    public function getCredentialsInCache()
    {
        if(isset(self::$credentialsCache[$this->key()])) {
            $result = self::$credentialsCache[$this->key()];
            if($this->expirationSlot <= strtotime($result["Expiration"]) - time()) {
                return $result;
            }
            unset(self::$credentialsCache[$this->key()]);
        }
    }
    protected function key()
    {
        return (string) $this->client->getCredential();
    }
    protected function cache(array $credential)
    {
        self::$credentialsCache[$this->key()] = $credential;
    }
}

?>